﻿@using CodeBuilder.Models.TemplateModels
@inherits RazorEngine.Templating.TemplateBase<CodeBuilder.Models.TemplateModels.DtoFileModel>
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using @(Model.Namespace).@(Model.DirName);

namespace @(Model.Namespace).EntityMapper
{
    public class @(Model.Name)Cfg : IEntityTypeConfiguration<@(Model.Name)>
    {

        public void Configure(EntityTypeBuilder<@(Model.Name)> builder)
        {
            builder.ToTable("@(Model.Name)");

            @foreach (ClassProperty classProperty in Model.ClassPropertys)
            {
                if (classProperty.PropertyType != "string")
                {
                    <text>            builder.Property(a => a.@classProperty.Name).HasMaxLength(128);
                    </text>
                }
            }

        }
    }
}